package request

// GetRiskRulesRequest 获取风控规则列表请求
type GetRiskRulesRequest struct {
	Page     int    `json:"page" form:"page" binding:"omitempty,min=1" example:"1"` // 页码
	PageSize int    `json:"page_size" form:"page_size" binding:"omitempty,min=1,max=100" example:"20"`
	Status   string `json:"status" form:"status" binding:"omitempty"`       // enabled, disabled, all
	RuleType string `json:"rule_type" form:"rule_type" binding:"omitempty"` // transaction, login, withdrawal, transfer, unusual
	Keyword  string `json:"keyword" form:"keyword" binding:"omitempty"`     // 搜索关键词
}

// GetRiskRuleRequest 获取单个风控规则请求
type GetRiskRuleRequest struct {
	ID int64 `uri:"id" binding:"required,min=1" example:"1"`
}

// CreateRiskRuleRequest 创建风控规则请求
type CreateRiskRuleRequest struct {
}

// UpdateRiskRuleRequest 更新风控规则请求
type UpdateRiskRuleRequest struct {
	ID          int64  `uri:"id" binding:"required,min=1" example:"1"`
	Name        string `json:"name" binding:"omitempty" example:"异常交易检测规则更新"`
	Description string `json:"description" binding:"omitempty"`
	RuleType    string `json:"rule_type" binding:"omitempty"`
	Condition   string `json:"condition" binding:"omitempty"`
	Action      string `json:"action" binding:"omitempty"`
	Priority    int    `json:"priority" binding:"omitempty,min=1,max=10"`
	Status      string `json:"status" binding:"omitempty"`
	Parameters  string `json:"parameters" binding:"omitempty"`
}

// DeleteRiskRuleRequest 删除风控规则请求
type DeleteRiskRuleRequest struct {
	ID int64 `uri:"id" binding:"required,min=1" example:"1"`
}

// ToggleRiskRuleStatusRequest 切换风控规则状态请求
type ToggleRiskRuleStatusRequest struct {
	ID     int64  `uri:"id" binding:"required,min=1" example:"1"`
	Status string `json:"status" binding:"required" example:"enabled"` // enabled, disabled
}

// ExecuteRiskCheckRequest 执行风控检查请求
type ExecuteRiskCheckRequest struct {
	UserID        int     `json:"user_id" binding:"required" example:"10001"`
	TransactionID string  `json:"transaction_id" binding:"omitempty" example:"TX202401010001"`
	Amount        float64 `json:"amount" binding:"required,min=0" example:"5000"`
	IP            string  `json:"ip" binding:"omitempty" example:"192.168.1.1"`
	DeviceInfo    string  `json:"device_info" binding:"omitempty"`
	ActionType    string  `json:"action_type" binding:"required" example:"withdrawal"` // withdrawal, recharge, transfer
}

// GetRiskLogsRequest 获取风控日志请求
type GetRiskLogsRequest struct {
	UserId        int64  `json:"user_id" form:"user_id"`
	RuleName      string `json:"rule_name" form:"rule_name"`
	TriggeredOnly bool   `json:"triggered_only" form:"triggered_only"`
	Page          int64  `json:"page" form:"page"`
	PageSize      int64  `json:"page_size" form:"page_size"`
}
